<?php
//error_reporting(0);
include("function.php");
include("upload.class.php");
$upload=new uploadFile();

$type =$_FILES['photo']['type'];

$upload->files= $_FILES['photo'];
$upload->uploaded="cache/".$_SESSION['login_mail'];
$upload->allow_types="jpeg|jpg|png|";
$upload->save_path="cache/";
$upload->file_name=$_SESSION['login_mail'];
$upload->upload_file($_FILES['photo']);

if($upload->errmsg != ""){
	$err=$upload->errmsg;
	echo "<script language=\"javascript\">alert('$err');</script>";
	//echo "<script language=\"javascript\">history.go(-1);</script>";
	}

$pictureup=$upload->uploaded;
$minpicture="cache/min".$_SESSION['login_mail'];
cutphoto($pictureup,$minpicture,220,220);
$picture=$minpicture;
unlink($pictureup);

imageStorage($picture);
 
unlink($picture); 

//$actual_name = iconv("UTF-8","gb2312",$actual_name);//进行编码转换
//move_uploaded_file($tmp_name,$dir.$actual_name); //把上传的照片存到 upload folder 里
echo "<script language=\"javascript\">alert('保存成功');</script>";
//echo "<img src='image.php?user_mail=$_SESSION[login_mail]' />"

?>